#include <bits/stdc++.h>
using namespace std;
const int N=2e5+50;
typedef long long ll;
ll a[N],b[N];
int n;
int main(void){
    scanf("%d",&n);
    for(int i=0;i<n/2;i++){
        scanf("%lld",&b[i]);
    }
    ll up=1e18+7;
    ll dw=0;
    for(int i=0,j=n-1;i<n/2;i++,j--){
        a[i]=dw;
        a[j]=b[i]-a[i];
        if(a[j]>up){
            a[j]=up;
            a[i]=b[i]-up;
        }
        dw=a[i];
        up=a[j];
    }
    for(int i=0;i<n;i++){
        if(i!=0){
            printf(" ");
        }
        printf("%lld",a[i]);
    }
    printf("\n");
    return 0;
}